package com.bjl.service;

import com.alibaba.fastjson.JSONObject;
import com.bjl.entity.User;
import orm.base.baseImp.BaseServiceInterface;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.List;
import java.util.Map;

/**
 * Created by ashin on 2017/11/9.
 */
public interface UserService extends BaseServiceInterface {

    /**
     * 登錄
     *
     * @param map
     * @param session
     * @param isBackend 是否是后台登录
     * @return
     * @throws Exception
     */
    public abstract JSONObject login(Map map, HttpSession session,boolean isBackend) throws Exception;


    /**
     * 退出登录
     *
     * @param map
     * @param session
     * @return
     * @throws Exception
     */
    public abstract JSONObject logout(Map map, HttpSession session) throws Exception;

    /**
     * 註冊
     *
     * @param map
     * @param session
     * @return
     * @throws Exception
     */
    public abstract JSONObject register(Map map, HttpSession session) throws Exception;

    /**
     * 查询用户最上级推荐人的信息
     * @param user
     * @return
     * @throws Exception
     */
    public abstract User findTopReferrerId(User user) throws Exception;

    /**
     * 查詢用戶所有的上級信息
     * @param user
     * @return
     * @throws Exception
     */
    public abstract List<User> findAllReferrerId(User user) throws Exception;

    /**
     * 向下查询所有用户id(管理层)
     * @param user
     * @return
     * @throws Exception
     */
    public abstract List<String> findDownwardUserId(User user) throws Exception;

    /**
     * 更新用户信息
     * @param map
     * @param session
     * @return
     * @throws Exception
     */
    public abstract JSONObject update(Map map,HttpSession session) throws Exception;

    /**
     * 获得未登录用户token
     * @param map
     * @return
     * @throws Exception
     */
    public abstract JSONObject getUnLoginUser(Map map) throws Exception;

    /**
     * 查询所有用户
     * @param map
     * @param session
     * @return
     * @throws Exception
     */
    public abstract JSONObject query(Map map,HttpSession session) throws Exception;

    /**
     * 分页查询所有用户
     * @param map
     * @param session
     * @return
     * @throws Exception
     */
    public abstract JSONObject pageQuery(Map map,HttpSession session) throws Exception;

    /**
     * 机型统计
     * @return
     * @throws Exception
     */
    public abstract JSONObject getPhoneType(HttpSession session) throws Exception;

    /**
     * 导出机型统计信息
     * @param session
     * @param response
     * @return
     * @throws Exception
     */
    public abstract void exportPhoneTypeCount(HttpSession session, HttpServletResponse response) throws Exception;

    /**
     * 导出用户查询列表
     * @param map
     * @param response
     * @throws Exception
     */
    public abstract void exportQuery(Map map,HttpSession session, HttpServletResponse response) throws Exception;

    /**
     * 刷新邀请码
     * @param map
     * @param session
     * @return
     * @throws Exception
     */
    public abstract JSONObject refreshInvCode(Map map,HttpSession session) throws Exception;

    /**
     * 判断是否是已经使用过的邀请码
     * @param map
     * @param session
     * @return
     * @throws Exception
     */
    public abstract JSONObject checkIsUsedInvCode(Map map,HttpSession session) throws Exception;

    /**
     * 每天领取积分
     * @param map
     * @param session
     * @return
     */
    public abstract JSONObject getAccountPerDay(Map map, HttpSession session) throws Exception;
}
